]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dbusService: Handle shell restarts better
authorFlorian Müllner <fmuellner@gnome.org>
Wed, 4 Sep 2024 18:48:55 +0000 (20:48 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 4 Feb 2025 11:22:59 +0000 (12:22 +0100)
Our D-Bus services don't make sense outside a GNOME session, so
they shut down automatically when gnome-shell is not on the bus.

However this does not only apply when activating a service from
a non-GNOME session, but also when restarting gnome-shell on Xorg.

This is particularly problematic for services that shut down
automatically, as they lose all tracking state, even when
re-activated.

Address this by queuing a shutdown check instead of shutting down
immediately, so that the service can pick up the new shell name
provided it appears before the timeout (i.e. two seconds).

Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/7843
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3463>

js/dbusServices/dbusService.js

index f1bc4c6f6496d7d151407e637ba8fcf7fb012655..85ed0d9ad02b345f69a7a3bf8c231de63aef155b 100644 (file)
@@ -30,7 +30,13 @@ export class ServiceImplementation {
             (c, name, owner) => (this._shellName = owner),
             () => {
                 this._shellName = null;
-                this.emit('shutdown');
+
+                // For auto-shutdown services, delay shutting
+                // down in case the shell reappears
+                if (this._autoShutdown)
+                    this._queueShutdownCheck();
+                else
+                    this.emit('shutdown');
             });
 
         this._hasSignals = this._dbusImpl.get_info().signals.length > 0;
@@ -104,7 +110,7 @@ export class ServiceImplementation {
         if (GLib.getenv('SHELL_DBUS_PERSIST'))
             return;
 
-        if (this._holdCount > 0)
+        if (this._shellName && this._holdCount > 0)
             return;
 
         this.emit('shutdown');